home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
JCSM Shareware Collection 1996 September
/
JCSM Shareware Collection (JCS Distribution) (September 1996).ISO
/
tutorial
/
trac.zip
/
EX-IV-2.TRA
< prev
next >
Wrap
Text File
|
1990-01-26
|
1KB
|
56 lines
0001 0
I 0
J 0
STRT LDFIVE X is value being tested
ST X start with 5
LD ONE J is the highest index
ST J in table of primes
RD XF Enter final X to test
SETI LDZERO I is index for prime table
ST I
COMR LD X Find whole part of X/T(I)
2DV T
2MU T Multiply it by T(I) and
SU X subtract X
BZINCX Is the remainder zero?
2LD T Find T(I)*T(I)
2MU T
STTSQR Save it
LD X Find X-T(I)*T(I)
SUTSQR
BNAPPT If negative, found a prime
LD I Else, increment I
AD ONE
ST I
BUCOMR and test with next prime
APPT LD X Put new prime in the table
3ST T X->T(J)
LD J Increment J
AD ONE
ST J
PC X Print it
INCX LD X Try next odd number
AD TWO
ST X
SU XF Does it exceed final value?
BNSETI If not, keep going
BZSETI
HT*
FIVE 5
ONE 1
ZERO 0
TWO 2
TSQR 0
X 0
0
0
0
0
XF 0
0
0
0
0
T 3
ENSTRT